@extends('admin.common.common')
@section('title')
个人中心
@endsection

@section('style')
  <link rel="stylesheet" href="/css/profile.css">
@endsection
@section('content')
<div class="profile container my-3 border border-info">
    <form action="{{url('/admin/user/edit/'.$user->id)}}" method="POST" enctype="multipart/form-data">
      <h4>个人信息</h4>
      <p class="bg-light">个人头像</p>
      <div class="user-img  overflow-hidden">
      @if($user->uimg)
        <img src="{{url('/'.$user->uimg)}}" class="border img border-primary rounded-circle" alt="">
      @else
        <i class="layui-icon-username layui-icon user-icon"></i>
      @endif
        <p class="bg-light">修改用户图像：<input type="file" name="pic" id="pic"></p>
      </div>
      <p class="bg-light"><span>用户名:</span> <input type="text" class="ml-5" name="uname" value="{{$user->uname}}">
        <span class="operation mr-5 float-right"><a href="javascript: ;" class="mod">修改</a></span>
      </p>
      <p class="bg-light"><span>手机:</span> <input class="ml-5" name="phone" type="text" value="{{$user->phone}}">
        <span class="operation mr-5 float-right"><a href="javascript: ;" class="mod">修改</a></span>
      </p>
      <p class="bg-light"><span>邮箱:</span> <input class="ml-5" name="email" value="{{$user->email}}" type="text">
        <span class="operation mr-5 float-right"><a href="javascript: ;" class="mod">修改</a></span>
      </p>
      <div class="text-center my-3 py-3">
      @csrf
      <button type="submit" class="btn dosub btn-primary">保存修改</button>
      </div>
    </form>
  </div>
@endsection
@section('script')
$('.mod').click(function() {
  var that = $(this);
  var index = layer.open({
    title: that.parent().prev().prev().html(),
    content: '<input class="con w-100 pl-1" type="text" value="'+that.parent().prev().val()+'">',
    yes: function(index, layero){
      that.parent().prev().val($('.con').val());
      layer.close(index); //如果设定了yes回调，需进行手工关闭
    }
  });
})
@if(session('status')) 
layer.alert("{{session('status')}}",{icon:1});
@endif
@endsection
